using System;
using System.ComponentModel.DataAnnotations;

namespace JGSY.CMS.LowCode.Platform.Application.DTOs
{
    /// <summary>
    /// 媒体文件数据传输对象
    /// 用于传输媒体文件相关的数据信息，包括文件类型、大小、路径等
    /// </summary>
    public class MediaFileDto
    {
        /// <summary>
        /// 媒体文件ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 文件名
        /// </summary>
        [Required(ErrorMessage = "文件名不能为空")]
        [StringLength(255, ErrorMessage = "文件名长度不能超过255个字符")]
        public string FileName { get; set; } = string.Empty;

        /// <summary>
        /// 原始文件名
        /// </summary>
        [StringLength(255, ErrorMessage = "原始文件名长度不能超过255个字符")]
        public string? OriginalFileName { get; set; }

        /// <summary>
        /// 文件路径
        /// </summary>
        [Required(ErrorMessage = "文件路径不能为空")]
        [StringLength(500, ErrorMessage = "文件路径长度不能超过500个字符")]
        public string FilePath { get; set; } = string.Empty;

        /// <summary>
        /// 文件URL
        /// </summary>
        [StringLength(500, ErrorMessage = "文件URL长度不能超过500个字符")]
        public string? FileUrl { get; set; }

        /// <summary>
        /// 文件大小（字节）
        /// </summary>
        [Range(0, long.MaxValue, ErrorMessage = "文件大小不能为负数")]
        public long FileSize { get; set; }

        /// <summary>
        /// 文件类型
        /// </summary>
        [Required(ErrorMessage = "文件类型不能为空")]
        [StringLength(100, ErrorMessage = "文件类型长度不能超过100个字符")]
        public string FileType { get; set; } = string.Empty;

        /// <summary>
        /// MIME类型
        /// </summary>
        [StringLength(255, ErrorMessage = "MIME类型长度不能超过255个字符")]
        public string? MimeType { get; set; }

        /// <summary>
        /// 文件分类
        /// </summary>
        [StringLength(50, ErrorMessage = "文件分类长度不能超过50个字符")]
        public string? Category { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [StringLength(255, ErrorMessage = "标题长度不能超过255个字符")]
        public string? Title { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [StringLength(500, ErrorMessage = "描述长度不能超过500个字符")]
        public string? Description { get; set; }

        /// <summary>
        /// 替代文本
        /// </summary>
        [StringLength(255, ErrorMessage = "替代文本长度不能超过255个字符")]
        public string? Alt { get; set; }

        /// <summary>
        /// 图片宽度（像素）
        /// </summary>
        public int? Width { get; set; }

        /// <summary>
        /// 图片高度（像素）
        /// </summary>
        public int? Height { get; set; }

        /// <summary>
        /// 时长（秒，用于视频/音频）
        /// </summary>
        public int? Duration { get; set; }

        /// <summary>
        /// 哈希值
        /// </summary>
        [StringLength(255, ErrorMessage = "哈希值长度不能超过255个字符")]
        public string? Hash { get; set; }

        /// <summary>
        /// 标签（JSON格式）
        /// </summary>
        public string? Tags { get; set; }

        /// <summary>
        /// 元数据（JSON格式）
        /// </summary>
        public string? Metadata { get; set; }

        /// <summary>
        /// 存储类型（本地/云端）
        /// </summary>
        [StringLength(50, ErrorMessage = "存储类型长度不能超过50个字符")]
        public string? StorageType { get; set; }

        /// <summary>
        /// 是否公开
        /// </summary>
        public bool IsPublic { get; set; }

        /// <summary>
        /// 下载次数
        /// </summary>
        public int DownloadCount { get; set; }

        /// <summary>
        /// SEO标题
        /// </summary>
        [StringLength(255, ErrorMessage = "SEO标题长度不能超过255个字符")]
        public string? SeoTitle { get; set; }

        /// <summary>
        /// SEO关键词
        /// </summary>
        [StringLength(500, ErrorMessage = "SEO关键词长度不能超过500个字符")]
        public string? SeoKeywords { get; set; }

        /// <summary>
        /// SEO描述
        /// </summary>
        [StringLength(500, ErrorMessage = "SEO描述长度不能超过500个字符")]
        public string? SeoDescription { get; set; }

        /// <summary>
        /// 自定义属性
        /// </summary>
        public string? CustomFields { get; set; }

        /// <summary>
        /// 排序权重
        /// </summary>
        public int SortOrder { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public byte Status { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        public int Version { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public long CreatedBy { get; set; }

        /// <summary>
        /// 修改人ID
        /// </summary>
        public long? UpdatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 创建人姓名
        /// </summary>
        public string? CreatorName { get; set; }

        /// <summary>
        /// 修改人姓名
        /// </summary>
        public string? UpdaterName { get; set; }

        /// <summary>
        /// 文件大小格式化显示
        /// </summary>
        public string? FileSizeFormatted { get; set; }

        /// <summary>
        /// 缩略图URL
        /// </summary>
        public string? ThumbnailUrl { get; set; }
    }
}
